﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CadastroIteracoes.aspx.cs" Inherits="WebApp_Scrum.Protegido.CadastroIteracoes" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblProjeto" runat="server" Text="Projeto"></asp:Label>
        <asp:DropDownList ID="dpProjetos" runat="server" DataSourceID="odsProjetos" 
            DataTextField="NomeProjeto" DataValueField="CodigoProjeto">
        </asp:DropDownList>
        <asp:Button ID="btnIteracoes" runat="server" onclick="btnIteracoes_Click" 
            Text="Listar iterações" />
        <asp:ObjectDataSource ID="odsProjetos" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="Listar" 
            TypeName="BLL.ProjetosBLL"></asp:ObjectDataSource>
        <br />
        <asp:GridView ID="gvIteracoes" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="CodigoIteracao" DataSourceID="odsIteracoes" 
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="CodigoIteracao" HeaderText="CodigoIteracao" 
                    SortExpression="CodigoIteracao" />
                <asp:BoundField DataField="CodigoProjeto" HeaderText="CodigoProjeto" 
                    SortExpression="CodigoProjeto" />
                <asp:BoundField DataField="NomeIteracao" HeaderText="NomeIteracao" 
                    SortExpression="NomeIteracao" />
                <asp:BoundField DataField="DataInicioIteracao" HeaderText="DataInicioIteracao" 
                    SortExpression="DataInicioIteracao" />
                <asp:BoundField DataField="DataTerminoIteracao" 
                    HeaderText="DataTerminoIteracao" SortExpression="DataTerminoIteracao" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="odsIteracoes" runat="server" 
            DataObjectTypeName="Models.Iteracoes" DeleteMethod="Excluir" 
            InsertMethod="Incluir" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="Listar" TypeName="BLL.IteracoesBLL" UpdateMethod="Alterar">
            <DeleteParameters>
                <asp:Parameter Name="CodigoIteracao" Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="dpProjetos" Name="CodigoProjeto" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <br />
        <asp:Button ID="btnNovaIteracao" runat="server" Text="Nova iteração" 
            onclick="btnNovaIteracao_Click" />
        <br />
        <asp:FormView ID="frvIteracoes" runat="server" 
            DataSourceID="odsDetailsIteracoes" CellPadding="4" ForeColor="#333333" 
            oniteminserted="frvIteracoes_ItemInserted" 
            onitemdeleted="frvIteracoes_ItemDeleted" 
            onitemupdated="frvIteracoes_ItemUpdated">
            <EditItemTemplate>                
                <asp:Label ID="CodigoIteracaoLabel" runat="server" visible="false"
                    Text='<%# Bind("CodigoIteracao") %>' />                
                CodigoProjeto:
                <asp:DropDownList ID="dpProjetoIteracao" runat="server"
                    Text='<%# Bind("CodigoProjeto") %>' DataSourceID="odsProjetoIteracao" 
                    DataTextField="NomeProjeto" DataValueField="CodigoProjeto" />                
                
                <asp:ObjectDataSource ID="odsProjetoIteracao" runat="server" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="Listar" 
                    TypeName="BLL.ProjetosBLL">
                </asp:ObjectDataSource>
                
               <%-- <asp:TextBox ID="CodigoProjetoTextBox" runat="server" 
                    Text='<%# Bind("CodigoProjeto") %>' />
                <br />--%>
                NomeIteracao:
                <asp:TextBox ID="NomeIteracaoTextBox" runat="server" 
                    Text='<%# Bind("NomeIteracao") %>' />
                <br />
                DataInicioIteracao:
              <%--  <asp:TextBox ID="DataInicioIteracaoTextBox" runat="server" 
                    Text='<%# Bind("DataInicioIteracao") %>' />--%>
                <asp:Calendar ID="DataInicio" runat="server" 
                    SelectedDate='<%# Bind("DataInicioIteracao") %>'></asp:Calendar>
                <br />
                DataTerminoIteracao:
                <asp:Calendar ID="DataFinal" runat="server" 
                    SelectedDate='<%# Bind("DataTerminoIteracao") %>'></asp:Calendar>
                <br />

<%--                <asp:TextBox ID="DataTerminoIteracaoTextBox" runat="server" 
                    Text='<%# Bind("DataTerminoIteracao") %>' />
                <br />
--%>                <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Salvar" />
                &nbsp;<asp:Button ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </EditItemTemplate>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <InsertItemTemplate>
                CodigoProjeto:
                <asp:DropDownList ID="dpProjetoIteracao" runat="server"
                    Text='<%# Bind("CodigoProjeto") %>' DataSourceID="odsProjetoIteracao" 
                    DataTextField="NomeProjeto" DataValueField="CodigoProjeto" />                
                <asp:ObjectDataSource ID="odsProjetoIteracao" runat="server" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="Listar" 
                    TypeName="BLL.ProjetosBLL">
                </asp:ObjectDataSource>

                NomeIteracao:
                <asp:TextBox ID="NomeIteracaoTextBox" runat="server" 
                    Text='<%# Bind("NomeIteracao") %>' />
                <br />
                DataInicioIteracao:
                <asp:TextBox ID="DataInicioIteracaoTextBox" runat="server" 
                    Text='<%# Bind("DataInicioIteracao") %>' />
                <br />
                DataTerminoIteracao:
                <asp:TextBox ID="DataTerminoIteracaoTextBox" runat="server" 
                    Text='<%# Bind("DataTerminoIteracao") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Inserir" />
                &nbsp;<asp:Button ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </InsertItemTemplate>
            <ItemTemplate>
                CodigoProjeto:
                <asp:Label ID="CodigoProjetoLabel" runat="server" 
                    Text='<%# Bind("CodigoProjeto") %>' />
                <br />
                NomeIteracao:
                <asp:Label ID="NomeIteracaoLabel" runat="server" 
                    Text='<%# Bind("NomeIteracao") %>' />
                <br />
                DataInicioIteracao:
                <asp:Label ID="DataInicioIteracaoLabel" runat="server" 
                    Text='<%# Bind("DataInicioIteracao") %>' />
                <br />
                DataTerminoIteracao:
                <asp:Label ID="DataTerminoIteracaoLabel" runat="server" 
                    Text='<%# Bind("DataTerminoIteracao") %>' />
                <br />
                <asp:Button ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Editar" />
                &nbsp;<asp:Button ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Excluir" />
            </ItemTemplate>
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
        </asp:FormView>
        <asp:ObjectDataSource ID="odsDetailsIteracoes" runat="server" 
            DataObjectTypeName="Models.Iteracoes" DeleteMethod="Excluir" 
            InsertMethod="Incluir" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="Ler" TypeName="BLL.IteracoesBLL" UpdateMethod="Alterar">
            <DeleteParameters>
                <asp:Parameter Name="CodigoIteracao" Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="gvIteracoes" Name="CodigoIteracao" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
    </div>
    </form>
</body>
</html>
